﻿Imports System.Net
Imports System.Xml

Public Class Communication
    Const APIBaseURI As String = "https://api.orb.com/orb/"

    Public Const APILogonURI As String = "xml/session.login"
    Public Const APIComputerStatus As String = "xml/computer.getStatus"
    Public Const APITvGetListings As String = "xml/tv.getListings"
    Public Const APIStream As String = "xml/stream"

    Function getResponseFromOrb(ByVal apifunc As String, ByVal parameters As String) As String
        Dim oWebC As New WebClient
        'Debug.Print((APIBaseURI & apifunc & "?" & parameters))
        Return oWebC.DownloadString((APIBaseURI & apifunc & "?" & parameters))

    End Function

    Function ConvertStringToXmlReader(ByVal s As String) As XmlNodeReader

        Dim doc As New XmlDocument

        doc.LoadXml(s)
        'Debug.Print(s)

        Return New XmlNodeReader(doc)

    End Function
End Class
